﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Logic.ClarizenObjects;
using Logic;

namespace ClarizenGadget.Controllers
{
    public class WorkItemController : Controller
    {
        //
        // GET: /WorkItem/

        [HttpPost]
        public ActionResult Edit(WorkItem t)
        {
            try
            {
                var wi = t.ToGenericEntity();
                new QueryComponent().UpdateEntity(wi);
                return Json(new GadgetResponse<WorkItem> { Data = t, Status = GadgetResponseStatus.Success });
            }
            catch (Exception e)
            {
                return Json(new GadgetResponse<Task> { Status = GadgetResponseStatus.Error, ErrorMessage = e.Message });
            }
        }

    }
}
